<script setup>
import { getSearchAPI } from '@/apis/search';
import { onMounted, ref } from 'vue';
import { useRoute } from 'vue-router';

// tab列表
const tabTypes = [
  { name: "publishTime", label: "发布时间" },
  { name: "orderNum", label: "订单号" },
  { name: "price", label: "价格" },
  { name: "evaluateNum", label: "评价数" }
]

const route = useRoute()

const params = ref({
  page: 1,
  pageSize: 10,
  keyword: route.params.string,
  sortField: 'publishTime',
  sortMethod: 'asc'
})
const searchList = ref([])
const getSearchList = () => {
  const res = getSearchAPI(params.value)
  searchList.value = res.result
}

onMounted(() => getSearchList())
</script>

<template>
  <div class="container">
    <!-- tab切换 -->
    <el-tabs>
      <el-tab-pane v-for="item in tabTypes" :key="item.name" :label="item.label" />
    </el-tabs>
  </div>
</template>

<style scoped lang="scss">
.container {
  padding: 20px;
  background: #fff;
  text-align: center;
  margin-top: 20px;
}
</style>
